<template>
  <div>
    <el-container>
      <el-header class="keyword">
        <el-form :inline="true" ref="form" :model="keyword" label-width="80px">
          <el-form-item>
            <el-button type="primary">添加用户</el-button>
          </el-form-item>
          <el-form-item label="姓名">
            <el-input placeholder="按姓名查询"></el-input>
          </el-form-item>
          <el-form-item label="科室">
            <el-select v-model="department" placeholder="请选择">
              <el-option
                v-for="item in departments"
                :key="item.value"
                :label="item.label"
                :value="item.value"
              ></el-option>
            </el-select>
          </el-form-item>
          <el-form-item label="级别">
            <el-select v-model="level" placeholder="请选择">
              <el-option
                v-for="item in levels"
                :key="item.value"
                :label="item.label"
                :value="item.value"
              ></el-option>
            </el-select>
          </el-form-item>
          <el-form-item>
            <el-button type="primary">查询</el-button>
          </el-form-item>
        </el-form>
      </el-header>
      <el-main>
        <el-table
          ref="multipleTable"
          :data="userData"
          tooltip-effect="dark"
          style="width: 100%"
          @selection-change="handleSelectionChange"
        >
          <el-table-column type="selection" width="55"></el-table-column>
          <el-table-column label="账号" width="120">
            <template slot-scope="scope">{{ scope.row.date }}</template>
          </el-table-column>
          <el-table-column prop="realName" label="姓名" width="120"></el-table-column>
          <el-table-column prop="role" label="角色" show-overflow-tooltip></el-table-column>
          <el-table-column prop="department" label="科室" show-overflow-tooltip></el-table-column>
          <el-table-column prop="job" label="职称" show-overflow-tooltip></el-table-column>
          <el-table-column prop="level" label="等级" show-overflow-tooltip></el-table-column>
          <el-table-column prop="createDate" label="创建日期" show-overflow-tooltip></el-table-column>
          <el-table-column label="操作">
            <template slot-scope="scope">
              <el-button size="mini" @click="handleEdit(scope.$index, scope.row)">编辑</el-button>
              <el-button size="mini" type="danger" @click="handleDelete(scope.$index, scope.row)">删除</el-button>
            </template>
          </el-table-column>
        </el-table>
        <el-pagination class="page" small layout="prev, pager, next" :total="50"></el-pagination>
      </el-main>
    </el-container>
  </div>
</template>

<script>
export default {
  name: "",
  data() {
    return {
      keyword: {},
      userData: [],
      departments: [],
      department: "",
      levels: [],
      level: "",
    };
  },
  methods: {
    handleSelectionChange(val) {
      this.multipleSelection = val;
    },
    handleEdit(index, row) {
      console.log(index, row);
    },
    handleDelete(index, row) {
      console.log(index, row);
    },
  },
};
</script>

<style lang="scss" scoped>
.keyword {
  text-align: left;
}
.page {
  margin-top: 10px;
}
</style>